<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>自定义指令</title>
    <script src="../vue.global.js"></script>
</head>
<body>
<div id="app"></div>
<script>
    const directives = {
        focus:{
            mounted(el){
                el.focus()
            }
        }
    }
    const app = Vue.createApp({
        directives: directives,
        data() {
            return {

            }
        },
        methods: {},
        template: `
          <input v-focus/>
        `
    });
    //自定义全局指令
    // app.directive('focus',{
    //     mounted(el){
    //         el.focus();
    //     }
    // })
    const vm = app.mount("#app");
</script>
</body>
</html>